*** Settings ***
Library           RequestsLibrary
Resource          ../common/common.robot

*** Test Cases ***
Test Case: 登录成功
    Create Session    login    ${host}
    ${header}    Create Default Header
    ${data}    Create Dictionary    userName=${adminUser}    password=${adminPassword}
    ${response}    POST On Session    login    /api/admin/account/login.ac    json=${data}    headers=${header}
    Log    ${response.cookies}
    Save Token    ${response}
    LOG    ${__TOKEN}
    LOG    ${__UID}
    Should Be Equal As Strings    ${response.json()['data']['name']}    小马哥

Test Case: 测试密码错误
    Create Session    login    ${host}
    ${header}   Create Default Header
    ${data}    Create Dictionary    userName=${adminUser}    password=123456
    ${response}    POST On Session    login    /api/admin/account/login.ac    json=${data}    headers=${header}
    Log    ${response.json()}
    Should Be Equal As Numbers    ${response.json()['status']}    401

Test Case: 测试账号错误
    Create Session    login    ${host}
    ${header}   Create Default Header
    ${data}    Create Dictionary    userName=123455    password=${adminPassword}
    ${response}    POST On Session    login    /api/admin/account/login.ac    json=${data}    headers=${header}
    Log    ${response.json()}
    Should Be Equal As Numbers    ${response.json()['status']}    401

